1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module adw.Bin;
26 
27 private import adw.c.functions;
28 public  import adw.c.types;
29 private import glib.ConstructionException;
30 private import gobject.ObjectG;
31 private import gtk.AccessibleIF;
32 private import gtk.AccessibleT;
33 private import gtk.BuildableIF;
34 private import gtk.BuildableT;
35 private import gtk.ConstraintTargetIF;
36 private import gtk.ConstraintTargetT;
37 private import gtk.Widget;
38 
39 
40 /**
41  * A widget with one child.
42  * 
43  * <picture>
44  * <source srcset="bin-dark.png" media="(prefers-color-scheme: dark)">
45  * <img src="bin.png" alt="bin">
46  * </picture>
47  * 
48  * The `AdwBin` widget has only one child, set with the [property@Bin:child]
49  * property.
50  * 
51  * It is useful for deriving subclasses, since it provides common code needed
52  * for handling a single child widget.
53  *
54  * Since: 1.0
55  */
56 public class Bin : Widget
57 {
58 	/** the main Gtk struct */
59 	protected AdwBin* adwBin;
60 
61 	/** Get the main Gtk struct */
62 	public AdwBin* getBinStruct(bool transferOwnership = false)
63 	{
64 		if (transferOwnership)
65 			ownedRef = false;
66 		return adwBin;
67 	}
68 
69 	/** the main Gtk struct as a void* */
70 	protected override void* getStruct()
71 	{
72 		return cast(void*)adwBin;
73 	}
74 
75 	/**
76 	 * Sets our main struct and passes it to the parent class.
77 	 */
78 	public this (AdwBin* adwBin, bool ownedRef = false)
79 	{
80 		this.adwBin = adwBin;
81 		super(cast(GtkWidget*)adwBin, ownedRef);
82 	}
83 
84 
85 	/** */
86 	public static GType getType()
87 	{
88 		return adw_bin_get_type();
89 	}
90 
91 	/**
92 	 * Creates a new `AdwBin`.
93 	 *
94 	 * Returns: the new created `AdwBin`
95 	 *
96 	 * Since: 1.0
97 	 *
98 	 * Throws: ConstructionException GTK+ fails to create the object.
99 	 */
100 	public this()
101 	{
102 		auto __p = adw_bin_new();
103 
104 		if(__p is null)
105 		{
106 			throw new ConstructionException("null returned by new");
107 		}
108 
109 		this(cast(AdwBin*) __p);
110 	}
111 
112 	/**
113 	 * Gets the child widget of @self.
114 	 *
115 	 * Returns: the child widget of @self
116 	 *
117 	 * Since: 1.0
118 	 */
119 	public Widget getChild()
120 	{
121 		auto __p = adw_bin_get_child(adwBin);
122 
123 		if(__p is null)
124 		{
125 			return null;
126 		}
127 
128 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
129 	}
130 
131 	/**
132 	 * Sets the child widget of @self.
133 	 *
134 	 * Params:
135 	 *     child = the child widget
136 	 *
137 	 * Since: 1.0
138 	 */
139 	public void setChild(Widget child)
140 	{
141 		adw_bin_set_child(adwBin, (child is null) ? null : child.getWidgetStruct());
142 	}
143 }